<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<div>
	<table>
		<thead>
			<tr>
				<th>id</th>
				<th>url</th>
				<th>op</th>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="pagingItems.items">
			<tr id='<s:property value="id"/>'>
				<td><s:property value="id"/></td>
				<td><div class='resource-image-wrapper'><img src='<s:property value="url"/>'/></div></td>
				<td><a id='delete-resource-link' href='#'>delete</a></td>
			</tr>
			</s:iterator>
		</tbody>
	</table>
</div>
<script type="text/javascript">
$('#delete-resource-link').click(function(){
	var $row = $(this).closest('tr');
	var id = $row.attr('id');
	$.ajax({
		url: 'delete-resource.action',
		data: 'resource.id=' + id,
		type: 'POST',
		success: function(data){
			$row.hide();
		}
	});
});
</script>